package com.guigu.eduservice.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 求购信息表（存储买家发布的二手机械求购需求）
 * </p>
 *
 * @author Xiaosong
 * @since 2025-10-10
 */
@Data
@TableName("purchase_demand")
public class PurchaseDemand implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 求购信息唯一标识
     */
    @TableId(value = "purchase_id", type = IdType.AUTO)
    private Long purchaseId;

    /**
     * 关联用户表user_id（求购信息发布者）
     */
    private Long userId;

    /**
     * 关联设备类型表equipment_type的type_id（替代原equipment_type字符串字段）
     */
    private Long typeId;

    /**
     * 求购设备品牌（可选，如"优先三一"）
     */
    private String brand;

    /**
     * 求购设备型号（可选，如"SY215C"）
     */
    private String model;

    /**
     * 期望价格（单位：元，买家可接受的最高价格）
     */
    private BigDecimal expectedPrice;

    /**
     * 期望设备年份（可选，如"2018年以后"）
     */
    private Integer expectedYear;

    /**
     * 设备参数要求（如"使用小时数不超过5000小时"）
     */
    private String parameterRequirement;

    /**
     * 联系人（求购咨询的对接人）
     */
    private String contactName;

    /**
     * 联系电话（求购咨询的联系方式）
     */
    private String contactPhone;

    /**
     * 求购状态（0-待处理，1-已分配，2-已成交，3-已取消）
     */
    private Boolean purchaseStatus;

    /**
     * 关联业务员表businessman_id（purchase_status=1时必填，负责跟进求购需求）
     */
    private Long businessmanId;

    /**
     * 发布时间（用户提交求购信息的时间）
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime releaseTime;

    /**
     * 记录创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;

    /**
     * 记录更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updateTime;
    /**
     * 其他表中的一列，关联其他表
     * **/
    @TableField(exist = false)
    private String typeName;
    @TableField(exist = false)
    private String phone;

    public Long getPurchaseId() {
        return purchaseId;
    }

    public void setPurchaseId(Long purchaseId) {
        this.purchaseId = purchaseId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getTypeId() {
        return typeId;
    }

    public void setTypeId(Long typeId) {
        this.typeId = typeId;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public BigDecimal getExpectedPrice() {
        return expectedPrice;
    }

    public void setExpectedPrice(BigDecimal expectedPrice) {
        this.expectedPrice = expectedPrice;
    }

    public Integer getExpectedYear() {
        return expectedYear;
    }

    public void setExpectedYear(Integer expectedYear) {
        this.expectedYear = expectedYear;
    }

    public String getParameterRequirement() {
        return parameterRequirement;
    }

    public void setParameterRequirement(String parameterRequirement) {
        this.parameterRequirement = parameterRequirement;
    }

    public String getContactName() {
        return contactName;
    }

    public void setContactName(String contactName) {
        this.contactName = contactName;
    }

    public String getContactPhone() {
        return contactPhone;
    }

    public void setContactPhone(String contactPhone) {
        this.contactPhone = contactPhone;
    }

    public Boolean getPurchaseStatus() {
        return purchaseStatus;
    }

    public void setPurchaseStatus(Boolean purchaseStatus) {
        this.purchaseStatus = purchaseStatus;
    }

    public Long getBusinessmanId() {
        return businessmanId;
    }

    public void setBusinessmanId(Long businessmanId) {
        this.businessmanId = businessmanId;
    }

    public LocalDateTime getReleaseTime() {
        return releaseTime;
    }

    public void setReleaseTime(LocalDateTime releaseTime) {
        this.releaseTime = releaseTime;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public String toString() {
        return "PurchaseDemand{" +
            "purchaseId = " + purchaseId +
            ", userId = " + userId +
            ", typeId = " + typeId +
            ", brand = " + brand +
            ", model = " + model +
            ", expectedPrice = " + expectedPrice +
            ", expectedYear = " + expectedYear +
            ", parameterRequirement = " + parameterRequirement +
            ", contactName = " + contactName +
            ", contactPhone = " + contactPhone +
            ", purchaseStatus = " + purchaseStatus +
            ", businessmanId = " + businessmanId +
            ", releaseTime = " + releaseTime +
            ", createTime = " + createTime +
            ", updateTime = " + updateTime +
        "}";
    }
}
